﻿namespace KingerRobot.MexicoSailunWMS.SpiService;

public class BMonitorServiceImpl : IMonitorManageService
{
    IMonitorManage _Monitor = new BMonitorManage();

    public List<LineMonitorBeans> GetLineMonitorBeans(LineMonitorParam param)
    {
        var result = _Monitor.GetLineMonitorBeans(param);

        return result;
    }

    public List<LineMonitorBeans> GetLineMonitorBeansV2()
    {
        var result = _Monitor.GetLineMonitorBeansV2();
        return result;
    }
    public List<LineMonitorBeans> GetLineMonitorBeansV3()
    {
        var result = _Monitor.GetLineMonitorBeansV3();
        return result;
    }
    public List<POSeBox> GetScadaBoxs()
    {
        var db = Db.Default;
        var sb = db.SeBoxs.ToList();
        return sb;
    }
    public int UpdateLineValue(UpdateLineInfoParam param) 
    {
        var result = _Monitor.UpdateLineValue(param);
        return result;
    }
    public List<LineMonitorBeans> GetLineMonitorBeansNew()
    {
        var result = _Monitor.GetLineMonitorBeansNew();
        return result;
    }
    public List<POVLocationEnableNum> GetRcsLocation()
    {
        var result = _Monitor.GetRcsLocation();
        return result;
    }
    public CuringListBeans GetCuringNodesByEquipId(CuringNodeParam param)
    {
        var equipId = param?.EquipId ?? 0;
        var result = _Monitor.GetCuringNodesByEquipId(equipId);
        return result;

    }

    //public List<TemAndHumBeans> GetTemperatureAndHumidity() 
    //{ 
    //    var result = _Monitor.GetTemperatureAndHumidity();
    //    return result;
    //}

    public CrnLocBeans GetLocMonitorsByCrn(CrnLocParam param)
    {
        if (param is null)
        {
            return null;
        }
        return _Monitor.GetLocMonitorsByCrn(param.CrnName);
    }
    public LineInfoBean GetLineInfoByLineId(LineInfoParam param)
    {
        if (param is null)
        {
            return null;
        }
        return _Monitor.GetLineInfoByLineId(param.Id ?? 0);
    }



    public List<CuringMessageBeans> GetCuringMessageBeans(CuringMessageParam param)
    {
        var result = _Monitor.GetCuringMessageBeans(param);

        return result;
    }

    public List<CrnTaskBeans> GetCrnTask(CrnMonitorParam param)
    {
        var result = _Monitor.GetCrnTask(param);
        return result;
    }

    public CrnEquipBeans GetCrnEquip(CrnMonitorParam param)
    {
        var result = _Monitor.GetCrnEquip(param);
        return result;
    }

    [OperationLog("指令重发")]
    public int ReSendCmds(long? cmdId, long userId, string userName, string clientHost)
    {
        if (cmdId is null) return -1;

        var result = _Monitor.ReSendCmds(cmdId);

        return result;
    }

    public List<EMSTaskBeans> GetEMSTasks(EmsMonitorParam param)
    {

        var result = _Monitor.GetEMSTasks(param);

        return result;
    }

    public EMSEquipBeans GetEMSEquip(EmsMonitorParam param)
    {

        var result = _Monitor.GetEMSEquip(param);

        return result;
    }
}

